from Tkinter import *
import tkMessageBox
#def change_text():
#    depll=depot.get()
#    description.insert(0, depll)
def save_text():
    try:
        fileD = open ("delivers.txt","a")
        fileD.write("Depot:\n")
        fileD.write("%s\n" % depot.get())
        fileD.write("description:\n")
        fileD.write("%s\n" % description.get())
        fileD.write("Address:\n")
        fileD.write("%s\n" % address.get("1.0",END))
        #depot.delete(0, END)
        depot.set(None)
        description.delete(0, END)
        address.delete("1.0", END)
    except Exception as ex:
        #app.title("%s" % ex)
        tkMessageBox.showerror("Error","Can't write to the file\n %s" % ex)
        #response = tkMessageBox.askyesnocancel("Gift?", "Gift wrap the package?")
        #app.title("%s" % response)

app = Tk()
app.title('Head-Ex Deliveries')
Label(app, text = "Depot:").pack()
#depot = Entry(app)
#depot.pack()
depot = StringVar()
depot.set(None)
Radiobutton(app, text = "Cambridge, MA", value = "Cambridge, MA", variable = depot).pack()
Radiobutton(app, text = "Cambridge, UK", value = "Cambridge, UK", variable = depot).pack()
Radiobutton(app, text = "Seattle, WA", value = "Seattle, WA", variable = depot).pack()
#Radiobutton(app, text = "Cambridge, UK").pack()
#Radiobutton(app, text = "Seattle, WA").pack()

Label(app,text="description:").pack()
description = Entry(app)
description.pack()

Label(app, text = "Address:").pack()
address = Text(app)
address.pack()

Button(app, text = "Save", command = save_text).pack()
app.mainloop()
